Repository navigation
fix(lint,core)!: refuse a lookup dependsOn filter key naming a formula of its target; an import lookup no scoped read answered is never out of scope - #37910
Conversation
…ts target; never probe a scoped lookup unscoped when no scoped read answered Claude-Session: https://claude.ai/code/session_01L6bhgXj9vLmZ3KE2rWhtBH Co-authored-by: Claude <noreply@anthropic.com>
…ade-guide entry Claude-Session: https://claude.ai/code/session_01L6bhgXj9vLmZ3KE2rWhtBH Co-authored-by: Claude <noreply@anthropic.com>
… lint minor Claude-Session: https://claude.ai/code/session_01L6bhgXj9vLmZ3KE2rWhtBH Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 8cff535454a2e580ee5f30ca772b96c6e93b104d && git checkout 8cff535454a2e580ee5f30ca772b96c6e93b104d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0a3ea67c2c02adbced1c43eda0f252eac3568123 40007bc293e47f0e84e2be456b495403899f1c78 && git checkout -B drift-repro 0a3ea67c2c02adbced1c43eda0f252eac3568123 && git merge --no-ff 40007bc293e47f0e84e2be456b495403899f1c78
node scripts/docs-audit/affected-docs.mjs --json 0a3ea67c2c02adbced1c43eda0f252eac3568123
|
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Inputs: card #37717 (body and its four comments: triage 7206273294, claim 7215661638, amendment 7215831279, os-dev-report 7217685430), PR #37910 (body, ten files, net diff against ① Derived judgments
② Semver levelClause-②: yes (narrowing) — matches the diff: metadata that publishes on
③ Boundary flags
④ Design judgmentThe narrowing makes the spec's own refusal real; it takes no declared capability away. Attempts to break it, all held:
No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 40007bc · card #37717 · area s2-data · 2026-11-27T12:06ZL1 checklist
Tier: H. Landing: hand-off to the maintainer follows this record. |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Tier H hand-off · 2026-11-27T12:07Z · head 40007bc · approver 维护者速读
|
Requested by Sales · project thread
Fixes #37717
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no
skills/page teaches adependsOnfilter key on a formula field;content/docs/data-modeling/import-mappings.mdxnames the refusal in this change维护者速读
dependsOn里,把筛选键指向目标对象上的公式字段时,os validate、构建以及 Studio、REST、MCP 保存都会直接报错,并点出是哪个字段、为什么不行、该改成哪个存储字段。以前这种写法能发布,之后记录选择器查不出候选,导入这一列的每一行都失败。What changes
@objectstack/lint, N2: thedependsOnfilter key must be filterable.validateObjectFieldRefs(validate-object-field-refs.ts) gains afilteredflag on its field-name slots, set on the REFERENCE half ofdependsOn(param, else the bare name orfield), the key the record picker's candidate query and the importer's scoped lookup filter the referenced object by. When that name resolves to an authored field of the referenced object that is computed on read (isVirtualSearchFieldfrom@objectstack/spec/data, the predicate the engine's filter seam and the import resolver already use), it reports aterror, under the existing rule idobject-field-ref-unknown, at the entry's path. It runs wherever that rule runs:os validate/lint/compile/buildand the runtime publish gate forobjectwrites. Example finding:{ field, param }form, or drop it. A formula on the OWNING side (dependsOn[i].field, the form's gate, read from the record being edited) stays legal.os explain object-field-ref-unknown(rule-explanations.ts) gains one sentence for it; the module note says what is judged and why.@objectstack/core, N4: no unscoped probe when no scoped read answered. The import resolver (import-runner.ts) now marks every scoped lookup none of whose candidate reads answered, and the field guard did not refuse, asRefMatch.scopeUnansweredwhen the refusals did not name an unfilterable scope field (that case keepsscopeUnqueryable).referenceNotFound(import-coerce.ts) returns the plainreference_not_foundrefusal for it before the unscoped probe. Before, an all-refused scoped lookup (for example every read refusedINVALID_FILTERbecause the row's master cell is a value the scoping field's type cannot take) was asked again without the scope and could answerreference_out_of_scope, a claim about where the value lives that the import never checked.RefMatchgains the optional memberscopeUnanswered.validation-message.tsjsdoc onimport_reference_scope_unqueryableand theimport-mappings.mdxparagraph now say that any other all-refused scoped lookup keepsreference_not_foundand the plain sentence and is not tried again without the scope. The docs paragraph also says the formula case is refused at authoring now.lookup-depends-on-param-computed-field-refused(packages/spec/src/migrations/entries/semantic/), notice only: no D2 conversion, since only the author knows which stored field carries the value the formula computes..changeset/37717-lookup-depends-on-param-computed-field.md:@objectstack/lintminor (the narrowing),@objectstack/coreand@objectstack/specpatch, BREAKING banner, FROM → TO,registereddisposition. The pending note.changeset/36794-wizard-reference-out-of-scope.mdis left as it is: its sentence "A scoped lookup whose reads are all refused for any other reason (no read access to the target, say) keeps the plainno record matchessentence." was loose onmain(review N4) and is exactly true after this change, so it is not rewritten.Small choices made here (dev's call, per the claim)
object-field-ref-unknown, not a new one. The roll-up filter position in the same rule already refuses a key computed on read under that id, and the rule already runs at error on every door this needs, so no new registration, explanation entry or door wiring was added.SEARCH_VIRTUAL_TYPES, todayformula), which is what the card names. Asecret/passwordfield, or one flaggedinternal: true, is also refused as a filter key for a non-system caller, but by a guard that judges the caller, not the field's storage; left out (see Acceptance notes).INVALID_FILTER: whatever refused every scoped read, the scope was never asked, so a hit without it says nothing about the scope.Tests
packages/lint/src/validate-object-field-refs.test.ts, in thedependsOndescribe: aparamnaming a formula of the referenced object is refused at.paramwith the field and the reason; a bare name that is a formula on the referenced side is refused at the entry; a storedparam, and a formula on the owning side only, pass; the runtime publish gate refuses it too (objects.crm_invoice.fields.contact.dependsOn[0].param). The file's own 200-character cap on every fired verdict still holds.packages/core/src/utils/import-runner-reference-master-scope.test.ts: every scoped read refusedINVALID_FILTERwhile the unscoped read would answer with a record under another project; the cell answersreference_not_found, the plain sentence, noscope, and every read of the target carried the scope (no unscoped probe).40007bc2, throughscripts/ablation-replace.mjs, each restored to theHEADblob withgit diff HEADempty):{ scopeUnanswered: true }→{}: the N4 pin goes red (reference_out_of_scopereceived), 1 failed / 19 passed; restored 20 passed.scopeUnansweredearly return deleted: the same pin red, 1 failed / 19 passed.filteredbranch disabled: 3 failed / 128 passed (the two refusals and the runtime-gate pin); restored 131 passed.Acceptance notes
objectstack validatepasses on all five example apps (app-crm,app-showcase,app-starter,app-todo,app-multi-package) with the new rule built in. Positive control on the same CLI: adding a formulaaccount_labeltoshowcase_contactand pointingshowcase_invoice.contact'sdependsOnparamat it exits 1 with the finding quoted above (both mutations restored). By reading, every other shippeddependsOnis clean: the five inplugin-sharingsit ontext/ non-picker fields, where the filter half has no reader and is not judged; every one in hotcrm (crm_account,crm_project) names alookup/master_detailfield of its target.dependsOnfilter key naming asecret/passwordfield or aninternal: truefield. Those are refused as filters for non-system callers by the credential and internal-field guards, a judgment about the caller, not about the field's storage.Verification
Read first: the
filteredbranch invalidateObjectFieldRefs(validate-object-field-refs.ts), the all-refused branch at the end of the resolver'slookup(import-runner.ts), and thescopeUnansweredreturn inreferenceNotFound(import-coerce.ts).Two-minute check:
pnpm --filter @objectstack/lint exec vitest run src/validate-object-field-refs.test.ts -t "formula"runs 3 tests, all green.Local readings (tree 40007bc, on main 1e721fd)
@objectstack/lintwhole package: 242 files / 9801 passed.@objectstack/corewhole package: 166 files / 3902 passed.typechecklint, core and spec: green.eslint --no-inline-configon the eight changed source files: 0 problems.objectstack validate: all five example apps pass; the positive control exits 1 with the new finding.dispatch-gates.mjs --commands, 119 commands, tree 40007bc): 116 exit 0. Three exit 3, prerequisite not met, NOT measured:check-plugin-teardown-shape --self-test(shallow clone),spec check:skill-examples(client-react not built),check:dual-build-cjs-loads; CI covers these families on this head.check:type-check-debtfirst queued behind the dogfood hold, then re-run under the lock: exit 0, 0 ledger entries above their number.os-verify-lock: VERDICT command-exit 0, Test Files 490 passed / 3 skipped (493), Tests 4144 passed / 68 skipped (4212), no failures.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgXj9vLmZ3KE2rWhtBH
Generated by Claude Code